package com.util;

import org.junit.Test;

import java.util.Objects;

/**
 * @Description
 * @Author away
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2019/11/13
 */
public class ObjectsDemo {

    /**
     * null判断
     */
    @Test
    public void test01(){
        Boolean flag = null;
        if(Objects.nonNull(flag)){
            System.out.println("flag is not null "+ flag);
        }
        if(Objects.isNull(flag)){
            System.out.println("flag is  null "+ flag);
        }
        if(Objects.requireNonNull(flag)){//throw exception
            System.out.println("flag is not null "+ flag);
        }
    }
}
